import request from '@/utils/request'

// 添加消息
export function addMessage(params) {
  return request({
    url: '/message/msMessage/add',
    method: 'post',
    data: {
      'content': params.content,
      'receiverId': params.receiverId,
      'title': params.title,
      'type': obj.type, // 0:报警 1:审批 2: 其他
    },
    port: { ENV_PORT: 8008 },
    ajaxType2: 'reqPost'

  })
}

// 消息列表
export function fetchMessageList(data) {
  return request({
    url: '/message/msMessage/queryList',
    method: 'get',
    params: {
      'receiverId':data.receiverId,
      'receiverType':data.receiverType,
      'type':data.type, // 0:报警 1:审批 2: 其他
      'pageIndex':data.pageIndex,
      'pageSize':data.pageSize 
    },
    port: { ENV_PORT: 8008 },
    ajaxType2: 'reqGet'

  })
}

// 已读消息
export function fetchReadedList(id) {
  return request({
    url: `/message/msMessage/readed?id=${id}`,
    method: 'put',
    port: { ENV_PORT: 8008 },
    ajaxType2: 'reqPut'

  })
}